<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
		<link rel="shortcut icon" href="/#" type="image/png">

		<title>首页</title>

		<!--icheck-->
		<link href="/js/iCheck/skins/minimal/minimal.css" rel="stylesheet">
		<link href="/js/iCheck/skins/square/square.css" rel="stylesheet">
		<link href="/js/iCheck/skins/square/red.css" rel="stylesheet">
		<link href="/js/iCheck/skins/square/blue.css" rel="stylesheet">

		<!--dashboard calendar     -->
		<link href="/css/clndr.css" rel="stylesheet">

		<!--common-->
		<link href="/css/style.css" rel="stylesheet">
		<link href="/css/style-responsive.css" rel="stylesheet">

		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<style>
			* {
				margin: 0;
				padding: 0
			}
			.test {
				width: 100%;
				height: 750px;
				overflow-x : hidden;
			}
		</style>
	</head>

	<body scroll="no" onresize="onBodyResize()">


			<!-- left side start-->
			<div class="left-side sticky-left-side" id="leftpanel">

				<!--logo and iconic logo start-->
				<div class="logo">
					<img src="/images/logo.png" alt="">
				</div>

				<div class="logo-icon text-center">
					<img src="/images/logo_icon.png" alt="">
				</div>
				<!--logo and iconic logo end-->

				<div class="left-side-inner">

					<!-- visible to small devices only -->
					<div class="visible-xs hidden-sm hidden-md hidden-lg">
						<div class="media logged-user">
							<img alt="" src="/images/photos/user-avatar.png" class="media-object">
							<div class="media-body">
								<h4><a href="/#"> </a></h4>
								<span> </span>
							</div>
						</div>

						<!--	<h5 class="left-nav-title">Account Information</h5>-->
						<ul class="nav nav-pills nav-stacked custom-nav">
							<li>
								<a href="/#"><i class="fa fa-user"></i> <span>个人资料</span></a>
							</li>
							<li>
								<a  href="#" onclick="openwithClick('/user_logout')" ><i class="fa fa-sign-out"></i> <span>退出</span></a>
							</li>
						</ul>
					</div>

					<!--sidebar nav start-->
					<ul class="nav nav-pills nav-stacked custom-nav">
						<li class="active">
							<a href="#" onclick="openwithClick('/dashbord.html')"  ><i class="fa fa-home"></i> <span>Dashboard</span></a>
						</li>
						<li class="menu-list">
							<a href="#"><i class="fa fa-users"></i> <span>用户管理 </span> </a>
							<ul class="sub-menu-list">
								<li>
									<a href="#" onclick="openwithClick('user_panel.html')"  > 用户列表</a>
								</li>
							</ul>
						</li>
						<!--<li class="menu-list"><a href="/"><i class="fa fa-gears"></i> <span>权限管理 </span></a>
							<ul class="sub-menu-list">
								<li><a href="/blank_page.html" target="maincontent"> Add privilege</a></li>
								<li><a href="/boxed_view.html" target="maincontent"> update privilege</a></li>

							</ul>
						</li>-->
						<li class="menu-list">
							<a href="/"><i class="fa fa-html5"></i> <span>App 管理</span></a>
							<ul class="sub-menu-list">
								<li>
									<a href="#" onclick="openwithClick('app_panel.html')"  >App 列表</a>
								</li>
								<li id="basicInfoMenu">

								</li>
							</ul>
						</li>

						<li class="menu-list">
							<a href="/"><i class="fa fa-sitemap"></i> <span> 业务API</span></a>
							<ul class="sub-menu-list">
								<li>
									<a href="#" onclick="openwithClick('/api_url_panel.html')" >API地址列表</a>
								</li>
								<li>
									<a href="#" onclick="openwithClick('/api_user_panel.html')"  >API账号列表</a>
								</li>

							</ul>
						</li>
						<li class="menu-list">
							<a href="/"><i class="fa fa-android"></i> <span> APP升级任务管理</span></a>
							<ul class="sub-menu-list">
								<li>
									<a href="#" onclick="openwithClick('/upv_task_content_panel.html')" >任务列表</a>
								</li>
								<li>
									<a href="#" onclick="openwithClick('/upv_user_task_panel.html')" >升级用户列表</a>
								</li>
							</ul>
						</li>
						<li class="menu-list">
							<a href="/"><i class="fa fa-stack-overflow"></i> <span> 消息主动推送</span></a>
							<ul class="sub-menu-list">
								<li>
									<a href="#" onclick="openwithClick('/push_event.html')" >推送消息</a>
								</li>
								<li>
									<a href="#" onclick="openwithClick('/nsq_admin.html')" >推送队列情况</a>
								</li>
							</ul>
						</li>
						<li class="menu-list">
							<a href="/"><i class="fa fa-laptop"></i> <span>操作日志 </span></a>
							<ul class="sub-menu-list">
								<li>
									<a href="#" onclick="openwithClick('/log_panel.html')"  > 日志查询</a>
								</li>
							</ul>
						</li>
						<li>
							<a href="#" onclick="confirmLogout()"><i class="fa fa-sign-in"></i> <span>登出</span></a>
						</li>
					</ul>
					<!--sidebar nav end-->

				</div>
			</div>
			<!-- left side end-->

			<!-- main content start-->
			<div class="main-content">

				<!-- header section start-->
				<div class="header-section" id="headerDiv">

					<!--toggle button start-->
					<a class="toggle-btn"><i class="fa fa-bars"></i></a>
					<!--toggle button end-->

					<!--notification menu start -->
					<div class="menu-right">
						<ul class="notification-menu">
							<li>
								<a href="/#" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
									<img src="/images/photos/user-avatar.png" alt="" id="personlogo" />
									<span class="caret"></span>
								</a>
								<ul class="dropdown-menu dropdown-menu-usermenu pull-right">
									<li>
										<a data-toggle='modal' href='#myModal' class='btn btn-success  btn-sm'>个人资料</a>
									</li>
									<li>
										<a onclick="confirmLogout()" href="#"><i class="fa fa-sign-out"></i>退出登录</a>
									</li>
								</ul>
							</li>
						</ul>
					</div>
					<!--notification menu end -->

				</div>
				<!-- header section end-->

				<!-- page heading start-->

				<!-- page heading end-->
				<!--	//-----------弹出个人资料的窗口------start------------>
				<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
								<h4 class="modal-title">个人资料</h4>
							</div>

							<div class="modal-body row">
								<div class="col-md-4">
									<div class="form-group">
										<label>昵称</label>
										<label class="form-control" id="profile_username" name="profile_username" />
									</div>
								</div>
								<div class="col-md-4">
									<div class="form-group">
										<label>姓名</label>
										<label class="form-control" id="profile_fullname" name="profile_fullname" />
									</div>
								</div>

								<div class="col-md-4">
									<div class="form-group">
										<label>电话</label>
										<label class="form-control" id="profile_tel" name="profile_tel" />
									</div>
								</div>

							</div>
							<div class="modal-body row">
								<div class="col-md-4">
									<div class="form-group">
										<label>部门</label>
										<label class="form-control" id="profile_department" name="profile_department" />
									</div>
								</div>
								<div class="col-md-3">
									<div class="form-group">
										<label>角色</label>
										<label class="form-control" id="profile_ismanager" name="profile_ismanager" />
									</div>
								</div>
								<div class="col-md-5">
									<div class="form-group">
										<label>Email</label>
										<label class="form-control" id="profile_email" name="profile_email" />
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!--   //-----------弹出个人资料的窗口------end----------      -->
				<!--body wrapper  start-->

				<div id="test" class="test">
			 		<iframe src="/dashbord.html" frameborder="no" name="maincontent" id="maincontent" scrolling="yes"  ></iframe>
				</div>
				<!--body wrapper end-->

			</div>

			<!-- main content end-->
		<script src="/js/jquery-1.10.2.min.js"></script>
		<!-- Placed js at the end of the document so the pages load faster -->
		<script src="/js/jquery-ui-1.9.2.custom.min.js"></script>
		<script src="/js/jquery-migrate-1.2.1.min.js"></script>
		<script src="/js/bootstrap.min.js"></script>
		<script src="/js/modernizr.min.js"></script>
		<script src="/js/jquery.nicescroll.js"></script>

		<!--common scripts for all pages-->
		<script src="/js/scripts.js"></script>

		<script src="/js/html5shiv.js"></script>
		<script src="/js/respond.min.js"></script>

		<script>

			$.fn.scrollUnique = function() {
				return $(this).each(function() {
					var eventType = 'mousewheel';
					if (document.mozHidden !== undefined) {
						eventType = 'DOMMouseScroll';
					}
					$(this).on(eventType, function(event) {
						// 一些数据
						var scrollTop = this.scrollTop,
								scrollHeight = this.scrollHeight,
								height = this.clientHeight;

						var delta = (event.originalEvent.wheelDelta) ? event.originalEvent.wheelDelta : -(event.originalEvent.detail || 0);

						if ((delta > 0 && scrollTop <= delta) || (delta < 0 && scrollHeight - height - scrollTop <= -1 * delta)) {
							// IE浏览器下滚动会跨越边界直接影响父级滚动，因此，临界时候手动边界滚动定位
							this.scrollTop = delta > 0? 0: scrollHeight;
							// 向上滚 || 向下滚
							event.preventDefault();
						}
					});
				});
			};

			$('#test').scrollUnique();



			var host = ""
			window.onload = function checkSession() {
				host = "http://" + window.location.host;
				getCookie("echosession");
				iframesetheight() ;
			}
			function openwithClick(url){
				document.getElementById("maincontent").src = url;
			}

			function iframesetheight() {
				var ifm = document.getElementById("maincontent");
				var subWeb = document.frames ? document.frames["maincontent"].document : ifm.contentDocument;
				if(ifm != null && subWeb != null) {
					ifm.height = subWeb.documentElement.clientHeight  ;
				}
				if (window.innerWidth >800){
					ifm.width = window.innerWidth - 241;
				}else{
					ifm.width = window.innerWidth ;
				}

			}
			function setMainContentHeight(row,rowHeight){
				var countheight = row*rowHeight+300;
				if (countheight < window.innerHeight){
					countheight = window.innerHeight-45;
				}
				document.getElementById("maincontent").height =countheight;
			}

			function onBodyResize(){
				iframesetheight() ;
				document.getElementById("maincontent").contentWindow.onBodyResize();

			}
			function getCookie(name) {

				var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
				if(arr = document.cookie.match(reg)) {
					if(arr[2]) {
						$.get(host + "/get_currentuser", null, getCurrentPersonSuccess);
					} else {
						gotoLoginPage();
					}
				} else {
					gotoLoginPage();
				}
			}

			function getCurrentPersonSuccess(obj, status, xhr) {
				if(obj === null) {
					gotoLoginPage();
				} else {
					var role = "用户";
					if(obj.is_manager == true) {
						role = "管理员";
						addMenu() //如果是管理员就添加菜单
					}

					$("#personlogo").after("<label>" + role + ":" + obj.username + "</label>");
					document.getElementById("profile_username").innerText = obj.username;
					document.getElementById("profile_fullname").innerText = obj.fullname;
					document.getElementById("profile_email").innerText = obj.mail;
					document.getElementById("profile_tel").innerText = obj.mobile;
					document.getElementById("profile_department").innerText = obj.department;
					document.getElementById("profile_ismanager").innerText = role;

				}
			}

			function fillUserInfoForm() {

				document.getElementById("nick_name").value = currentListData[i].nick_name;
				document.getElementById("password").value = currentListData[i].pswd;
				document.getElementById("confirm_password").value = currentListData[i].pswd;
				document.getElementById("first_name").value = currentListData[i].first_name;
				document.getElementById("last_name").value = currentListData[i].last_name;
				document.getElementById("job").value = currentListData[i].job;
				document.getElementById("email").value = currentListData[i].email;
				document.getElementById("sex").value = currentListData[i].sex;
				if(currentListData[i].enable == 1) {
					document.getElementById("enable").checked = "checked";
				} else {
					document.getElementById("enable").checked = "";
				}
				if(currentListData[i].is_manager == 1) {
					document.getElementById("is_manager").checked = "checked";
				} else {
					document.getElementById("is_manager").checked = "";
				}
				document.getElementById("comment").value = currentListData[i].comment;
			}

			function confirmLogout() {
				if(confirm('确定要退出？')) {
					$.get(host + "/user_logout", null, logoutSuccess);
				}
			}
			function logoutSuccess(obmj) {
				window.location.href = obmj;
			}

			function gotoLoginPage() {
				//window.location.href = "http://auth.int.jumei.com/api/login/?login_url=/index.html&camefrom=acsman&relogin";
				window.location.href = "http://auth.jumeird.com/api/login/?login_url=/index.html&camefrom=acs_dev&relogin";
			}

			function addMenu() {
				tablebody = $("#basicInfoMenu");
				tablebody.empty();

				adddata = "";
				adddata += ("<a href=\"#\" onclick=\"openwithClick('/basic_info.html')\"  >基础信息</a>");
				tablebody.append(adddata);
			}
		</script>

	</body>

</html>
